package cn.easybuy.web.backend;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;

import cn.easybuy.dao.ProductCategoryDao;
import cn.easybuy.dao.impl.ProductCategoryDaoImpl;
import cn.easybuy.entity.ProductCategory;

public class ProductUpdateServlet1 extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// 根据一级菜单id查二级菜单
		ProductCategoryDao pcd = new ProductCategoryDaoImpl();
		String id1 = request.getParameter("id1");
		List<ProductCategory> list2 = pcd.getProductCategoriesByParentId(Integer.parseInt(id1));
		PrintWriter out = response.getWriter();
		String list2JSON=JSON.toJSONString(list2);
		out.print(list2JSON);
		out.flush();
		out.close();

	}

}
